package learnScala

import test.Test111

import scala.collection.mutable.ArrayBuffer


object ArrayAndMap {

    /*def printlnarr(array: Array[Int]): Unit = {
        for(i <- 0 until array.length)print(array(i) + " ") //输出默认  1 0 4 0 0
    }*/

    def main(args: Array[String]): Unit = {
        //数组
        //定义数组，并指定长度
        val arr1 = new Array[Int](5)
        arr1(0) = 1
        arr1(2) = 4
       // printlnarr(arr1)

        //初始化并赋值
        val arr2 = Array[String]("lyb","qqq")
        val arr22 = Array.apply[String]("lyb","qqq")
        val arr3 = Array("qq","ee")
        val arr33 = Array.apply("qq","ee")
       // arr33.foreach(println)
       val ab1 = new ArrayBuffer[Int](5)
        ab1.append(1,2,3)

        ab1.foreach(println)
        ab1.prepend(4,5)
        println(ab1.length)

        val mmap = Map((1,"t1"),(2,"t2"))
        mmap.foreach(println)


    }

}
